<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>购物案例</title>
    <link rel="stylesheet" type="text/css" href="C:\Users\棉花冲冲冲\Documents\Tencent Files\269712431\FileRecv\购物车案例\style.css">
</head>
<body>
    <div id="app">
        <div v-if="books.length">
            <table>
                <tr>
                    <th></th>
                    <th>书籍名称</th>
                    <th>出版日期</th>
                    <th>价格</th>
                    <th>购买数量</th>
                    <th>操作</th>
                </tr>
                <tr v-for="(item, index) in books">
                    <td>{{item.id}}</td>
                    <td>{{item.name}}</td>
                    <td>{{item.date}}</td>
                    <td>{{showprice(item.price)}}</td>
                    <td>
                        <button @click="decrement(index)" :disabled="item.count <= 1">-</button>
                        {{item.count}}
                        <button @click="increment(index)">+</button>
                    </td>
                    <td>
                        <button @click="removeitem(index)">移除</button>
                    </td>
                </tr>
            </table>
            <div>总价: {{totalprice | showprice}}

            </div>
            <div v-else>购物车为空</div>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
        <script src="C:\Users\棉花冲冲冲\Documents\Tencent Files\269712431\FileRecv\购物车案例\main.js"></script>
</div>
    
   
    
</body>
</html>